libxc: elf_kernel loader: Remove check for shstrtab
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 17 May 2019 11:38:43 +0000 (12:38 +0100)
committerWei Liu <wei.liu2@citrix.com>
Fri, 17 May 2019 15:14:04 +0000 (16:14 +0100)
commit582a298b215088acb042793da91f0baa8ce34425
tree7acc0fb25ab2f1df1ba3cbfebcedbb3c00ac6bb9
parentffd3367ed682b6ac6f57fcb151921054dd4cce7e
libxc: elf_kernel loader: Remove check for shstrtab

This was probably useful as a sanity check when the "__xen_guest"
section were not legacy.  But now ELF notes are prefered and
"should live in a PT_NOTE segment" (elfnote.h).

This check is unnecessary as elf_xen_parse() from xen/common/libelf
will do the right thing and look for ELFNOTEs in the different places
in order of preference. elf_xen_parse() will still be able to also
look for the legacy "__xen_guest" section without the check in libxc.

This patch would allow to write a simpler ELF header for an OVMF blob
(which isn't an ELF) and allow it to be loaded as a PVH kernel. The
header only needs to declare two program segments:
- one to tell an ELF loader where to put the blob,
- one for a Xen ELFNOTE.

The ELFNOTE is to comply to the pvh design which wants the
XEN_ELFNOTE_PHYS32_ENTRY to declare a blob as compaptible with the PVH
boot ABI.

Note that without the ELFNOTE, libxc will load an ELF but with
the plain ELF loader, which doesn't check for shstrtab.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/libxc/xc_dom_elfloader.c